package com.hws.leetcode.Day_01_09;

/**
 * ClassName:leetcode_392
 * Package:com.hws.leetcode.Day_01_09
 * Description:
 *
 * @ date:2022/1/9 15:13
 * @ author:hws
 */
public class leetcode_392 {
    public boolean isSubsequence(String s, String t) {
        int i = 0;
        int j = 0;
        char[] sChars = s.toCharArray();
        char[] tChars = t.toCharArray();
        while (i < sChars.length && j < tChars.length) {
            if (sChars[i] == tChars[j]) {
                i++;
            }
            j++;
        }
        return i == s.length();
    }

    public static void main(String[] args) {
        leetcode_392 lc = new leetcode_392();
        System.out.println(lc.isSubsequence("axc", "ahbgdc"));
    }
}
